package com.yuanian.timingwheel.distributedlock;

/**
 * 分布式锁
 */
public interface DistributedLock<T> {

    /**
     * 锁住资源，执行业务逻辑
     * @param resourceName
     * @param action
     * @return
     */
    T lock(String resourceName, BusinessAction<T> action);

    /**
     * 业务逻辑接口
     * @param <T>
     */
    public interface BusinessAction<T> {

        T doAction();

    }
}
